package com.web.crawler.k_means;

import java.io.IOException;
import java.util.Scanner;

public class DocumentClusteringApp {
    public static void main(String[] args) {
        try {
            Scanner scanner = new Scanner(System.in);

            System.out.println("Select language (1-English, 2-Chinese):");
            int langChoice = scanner.nextInt();
            scanner.nextLine(); // consume newline

            String folderPath = langChoice == 1 ? "C:\\Users\\jf\\IdeaProjects\\web-crawler\\documents\\en" :
                    "C:\\Users\\jf\\IdeaProjects\\web-crawler\\documents\\zh";

            System.out.println("Loading and vectorizing documents...");
            ClusteringAnalyzer analyzer = new ClusteringAnalyzer(folderPath);

            // 定义要测试的不同k值
            int[] kValues = {5, 10, 20, 25, 50};

            System.out.println("\nStarting clustering analysis...");
            analyzer.analyze(kValues);

        } catch (IOException e) {
            e.printStackTrace();
            System.err.println("Error processing documents: " + e.getMessage());
        }
    }
}